<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
    "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">
<html><head>
    <title>NKDInterleavedTwoOfFiveBarcode</title>
	<meta name="generator" content="HeaderDoc">
</head><body bgcolor="#ffffff"><h1><font face="Geneva,Arial,Helvtica">NKDInterleavedTwoOfFiveBarcode</font></h1><hr><br>
<h2>Abstract</h2>
Two of Five barcode that uses both bars and gaps to encode numeric data
<h2>Discussion</h2>
Interleaved 2 of 5 uses Wide and Narrow bars interleaved (digits 1 and 2 occupy the same
space, one is bars, the other by the spaces. Therefore, we won't be using _encodeChar - we'll
override the barcode method to use a class-specific method called _getBarForDigit:forBarNumber
<br><br>
Because of the interleaving, there must be an even number of characters; With the check-digit, odd
length values become even and even-length become odd. Odd numbers (even when check-digit used)
are zero-padded to make an even-length value.
 <hr><br><h2>Methods</h2>

<h3><a name="_getBarForDigit:forBarNumber:">_getBarForDigit:forBarNumber:</a></h3>
<b>Abstract:</b> Tells if the (bar/gap) in a particular position for a particular character should be wide or narrow.

<blockquote><pre><tt>- (BOOL)<B>_getBarForDigit:</B>(char)<I>inChar</I> <B>forBarNumber:</B>(int)<I>theBar;</I> </tt><br>
</pre></blockquote>
<p>This is a private method used by the overridden barcode method.
 </p>
<hr>

<h3><a name="barcode">barcode</a></h3>
<b>Abstract:</b> Overridden to implement interleaving of encoding

<blockquote><pre><tt>- (NSString *)<B>barcode;</B> </tt><br>
</pre></blockquote>
<p>Most other barcodes implemented in this framework use a distinct set of bars and gaps to represent
a single character. The <I>interleaved</I> 2 of 5 barcode encodes two characters in each distinct
grouping - one using the bar widths and one using the spaces. Therefore, we have to encode two characters
at a time when the superclass behavior is to encode individual characters.
</p>
<b>Result:</b> String of 0s and 1s that represent the encoded data
 
<hr>

<h3><a name="generateChecksum">generateChecksum</a></h3>
<b>Abstract:</b> Generates simple 10-modulus(10) check digit

<blockquote><pre><tt>- (void)<B>generateChecksum;</B> </tt><br>
</pre></blockquote>
<p>The check digit for interleaved 2 of 5 is a simple modulus 10 calculation - in other words, the check digit is what
number needs to be added to the sum of the other digits to make a number evenly divisible by 10.
 </p>
<hr>

<h3><a name="initiator">initiator</a></h3>
<b>Abstract:</b> Overriden method specifies Interleaved Two of Five start character

<blockquote><pre><tt>- (NSString *)<B>initiator;</B> </tt><br>
</pre></blockquote>
<p></p>
<b>Result:</b> "1010" representing narrow bar, narrow gap, narrow bar, narrow gap
 
<hr>

<h3><a name="isContentValid">isContentValid</a></h3>
<b>Abstract:</b> Enforces numeric-only content for this barcode.

<blockquote><pre><tt>- (BOOL)<B>isContentValid;</B> </tt><br>
</pre></blockquote>
<p></p>
<b>Result:</b> YES if the provided string value has only numeric values, NO otherwise
 
<hr>

<h3><a name="terminator">terminator</a></h3>
<b>Abstract:</b> Overriden method specifies Interleaved Two of Five stop character

<blockquote><pre><tt>- (NSString *)<B>terminator;</B> </tt><br>
</pre></blockquote>
<p></p>
<b>Result:</b> "11101" representing medium bar, narrow gap, narrow bar narrow gap. The two narrow bars allows the code
to be read in reverse; "1010" could also be used, but would result in a unidirectional barcode
 
<hr>
<p>(Last Updated 4/21/2003)
</p></body></html>
